package com.hyp.mapper;

import com.hyp.pojo.Emp;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface EmpMapper {
    @Select("select * from emp where EmpName = #{empName} and EmpPassword = #{empPassword}")
    Emp getByEmpnameAndEmpPassword(Emp emp);

    @Select("select * from emp")
    List<Emp> list();

    @Select("select  * from emp where EmpID =#{id}")
    Emp getById(Integer id);

    @Insert("insert into emp (Name, EmpName, EmpPassword, CreatedAt, UpdatedAt) " +
            "values (#{name}, #{empName}, #{empPassword}, #{createdAt}, #{updatedAt}) ")
    void addSave(Emp emp);

    @Delete("delete from emp where EmpID = #{id}")
    void delete(Integer id);


    void update(Emp emp);
}
